import torch
import math

IMU_NAME_TO_INDEX = {
    'body': 3,
    'neck': 1,
    'rarmu': 4,
    'rarmd': 7,
    'larmu': 2,
    'larmd': 8,
    'rlegu': 9,
    'rlegd': 6,
    'llegu': 0,
    'llegd': 5,

}

LIST_OF_IMUS = [k for k in IMU_NAME_TO_INDEX.keys()]
IMU_INDEX_TO_NAME = {v:k for (k, v) in IMU_NAME_TO_INDEX.items()}

#This is for 30 %
IMU_NAME_TO_LIMITS_DEG = {'llegu': {'min': 1.9965503, 'max': 11.359613}, 'neck': {'min': 2.287082, 'max': 6.5556226}, 'larmu': {'min': 2.8277004, 'max': 9.832891}, 'body': {'min': 1.9111532, 'max': 6.1582193}, 'rarmu': {'min': 3.103058, 'max': 10.392059}, 'llegd': {'min': 1.8808433, 'max': 12.496767}, 'rlegd': {'min': 1.8805944, 'max': 12.447176}, 'rarmd': {'min': 3.872594, 'max': 13.986033}, 'larmd': {'min': 3.476809, 'max': 13.410625}, 'rlegu': {'min': 2.0398395, 'max': 11.654064}} # this is 30%

IMU_NAME_TO_LIMITS = {imu: {k:math.radians(v) for (k,v) in min_max.items()} for (imu,min_max) in IMU_NAME_TO_LIMITS_DEG.items()}


CLUSTER_MEAN_STD_DICT = {
    'angle_axis_mag_semiclass': {'mean':10, 'std': 10},
}
DIRECTION_CLUSTER_CENTERS = torch.Tensor([1,2])
MAGNITUDE_THR = torch.Tensor([1,2])
DIRECTION_WEIGHTS = torch.Tensor([1,2])

SUN_SCENE_LABEL2IND = {'abbey': 0, 'airplane_cabin': 1, 'airport_terminal': 2, 'alley': 3, 'amphitheater': 4, 'amusement_arcade': 5, 'amusement_park': 6, 'anechoic_chamber': 7, 'apartment_building/outdoor': 8, 'apse/indoor': 9, 'aquarium': 10, 'aqueduct': 11, 'arch': 12, 'archive': 13, 'arrival_gate/outdoor': 14, 'art_gallery': 15, 'art_school': 16, 'art_studio': 17, 'assembly_line': 18, 'athletic_field/outdoor': 19, 'atrium/public': 20, 'attic': 21, 'auditorium': 22, 'auto_factory': 23, 'badlands': 24, 'badminton_court/indoor': 25, 'baggage_claim': 26, 'bakery/shop': 27, 'balcony/exterior': 28, 'balcony/interior': 29, 'ball_pit': 30, 'ballroom': 31, 'bamboo_forest': 32, 'banquet_hall': 33, 'bar': 34, 'barn': 35, 'barndoor': 36, 'baseball_field': 37, 'basement': 38, 'basilica': 39, 'basketball_court/outdoor': 40, 'bathroom': 41, 'batters_box': 42, 'bayou': 43, 'bazaar/indoor': 44, 'bazaar/outdoor': 45, 'beach': 46, 'beauty_salon': 47, 'bedroom': 48, 'berth': 49, 'biology_laboratory': 50, 'bistro/indoor': 51, 'boardwalk': 52, 'boat_deck': 53, 'boathouse': 54, 'bookstore': 55, 'booth/indoor': 56, 'botanical_garden': 57, 'bow_window/indoor': 58, 'bow_window/outdoor': 59, 'bowling_alley': 60, 'boxing_ring': 61, 'brewery/indoor': 62, 'bridge': 63, 'building_facade': 64, 'bullring': 65, 'burial_chamber': 66, 'bus_interior': 67, 'butchers_shop': 68, 'butte': 69, 'cabin/outdoor': 70, 'cafeteria': 71, 'campsite': 72, 'campus': 73, 'canal/natural': 74, 'canal/urban': 75, 'candy_store': 76, 'canyon': 77, 'car_interior/backseat': 78, 'car_interior/frontseat': 79, 'carrousel': 80, 'casino/indoor': 81, 'castle': 82, 'catacomb': 83, 'cathedral/indoor': 84, 'cathedral/outdoor': 85, 'cavern/indoor': 86, 'cemetery': 87, 'chalet': 88, 'cheese_factory': 89, 'chemistry_lab': 90, 'chicken_coop/indoor': 91, 'chicken_coop/outdoor': 92, 'childs_room': 93, 'church/indoor': 94, 'church/outdoor': 95, 'classroom': 96, 'clean_room': 97, 'cliff': 98, 'cloister/indoor': 99, 'closet': 100, 'clothing_store': 101, 'coast': 102, 'cockpit': 103, 'coffee_shop': 104, 'computer_room': 105, 'conference_center': 106, 'conference_room': 107, 'construction_site': 108, 'control_room': 109, 'control_tower/outdoor': 110, 'corn_field': 111, 'corral': 112, 'corridor': 113, 'cottage_garden': 114, 'courthouse': 115, 'courtroom': 116, 'courtyard': 117, 'covered_bridge/exterior': 118, 'creek': 119, 'crevasse': 120, 'crosswalk': 121, 'cubicle/office': 122, 'dam': 123, 'delicatessen': 124, 'dentists_office': 125, 'desert/sand': 126, 'desert/vegetation': 127, 'diner/indoor': 128, 'diner/outdoor': 129, 'dinette/home': 130, 'dinette/vehicle': 131, 'dining_car': 132, 'dining_room': 133, 'discotheque': 134, 'dock': 135, 'doorway/outdoor': 136, 'dorm_room': 137, 'driveway': 138, 'driving_range/outdoor': 139, 'drugstore': 140, 'electrical_substation': 141, 'elevator/door': 142, 'elevator/interior': 143, 'elevator_shaft': 144, 'engine_room': 145, 'escalator/indoor': 146, 'excavation': 147, 'factory/indoor': 148, 'fairway': 149, 'fastfood_restaurant': 150, 'field/cultivated': 151, 'field/wild': 152, 'fire_escape': 153, 'fire_station': 154, 'firing_range/indoor': 155, 'fishpond': 156, 'florist_shop/indoor': 157, 'food_court': 158, 'forest/broadleaf': 159, 'forest/needleleaf': 160, 'forest_path': 161, 'forest_road': 162, 'formal_garden': 163, 'fountain': 164, 'galley': 165, 'game_room': 166, 'garage/indoor': 167, 'garbage_dump': 168, 'gas_station': 169, 'gazebo/exterior': 170, 'general_store/indoor': 171, 'general_store/outdoor': 172, 'gift_shop': 173, 'golf_course': 174, 'greenhouse/indoor': 175, 'greenhouse/outdoor': 176, 'gymnasium/indoor': 177, 'hangar/indoor': 178, 'hangar/outdoor': 179, 'harbor': 180, 'hayfield': 181, 'heliport': 182, 'herb_garden': 183, 'highway': 184, 'hill': 185, 'home_office': 186, 'hospital': 187, 'hospital_room': 188, 'hot_spring': 189, 'hot_tub/outdoor': 190, 'hotel/outdoor': 191, 'hotel_room': 192, 'house': 193, 'hunting_lodge/outdoor': 194, 'ice_cream_parlor': 195, 'ice_floe': 196, 'ice_shelf': 197, 'ice_skating_rink/indoor': 198, 'ice_skating_rink/outdoor': 199, 'iceberg': 200, 'igloo': 201, 'industrial_area': 202, 'inn/outdoor': 203, 'islet': 204, 'jacuzzi/indoor': 205, 'jail/indoor': 206, 'jail_cell': 207, 'jewelry_shop': 208, 'kasbah': 209, 'kennel/indoor': 210, 'kennel/outdoor': 211, 'kindergarden_classroom': 212, 'kitchen': 213, 'kitchenette': 214, 'labyrinth/outdoor': 215, 'lake/natural': 216, 'landfill': 217, 'landing_deck': 218, 'laundromat': 219, 'lecture_room': 220, 'library/indoor': 221, 'library/outdoor': 222, 'lido_deck/outdoor': 223, 'lift_bridge': 224, 'lighthouse': 225, 'limousine_interior': 226, 'living_room': 227, 'lobby': 228, 'lock_chamber': 229, 'locker_room': 230, 'mansion': 231, 'manufactured_home': 232, 'market/indoor': 233, 'market/outdoor': 234, 'marsh': 235, 'martial_arts_gym': 236, 'mausoleum': 237, 'medina': 238, 'moat/water': 239, 'monastery/outdoor': 240, 'mosque/indoor': 241, 'mosque/outdoor': 242, 'motel': 243, 'mountain': 244, 'mountain_snowy': 245, 'movie_theater/indoor': 246, 'museum/indoor': 247, 'music_store': 248, 'music_studio': 249, 'nuclear_power_plant/outdoor': 250, 'nursery': 251, 'oast_house': 252, 'observatory/outdoor': 253, 'ocean': 254, 'office': 255, 'office_building': 256, 'oil_refinery/outdoor': 257, 'oilrig': 258, 'operating_room': 259, 'orchard': 260, 'outhouse/outdoor': 261, 'pagoda': 262, 'palace': 263, 'pantry': 264, 'park': 265, 'parking_garage/indoor': 266, 'parking_garage/outdoor': 267, 'parking_lot': 268, 'parlor': 269, 'pasture': 270, 'patio': 271, 'pavilion': 272, 'pharmacy': 273, 'phone_booth': 274, 'physics_laboratory': 275, 'picnic_area': 276, 'pilothouse/indoor': 277, 'planetarium/outdoor': 278, 'playground': 279, 'playroom': 280, 'plaza': 281, 'podium/indoor': 282, 'podium/outdoor': 283, 'pond': 284, 'poolroom/establishment': 285, 'poolroom/home': 286, 'power_plant/outdoor': 287, 'promenade_deck': 288, 'pub/indoor': 289, 'pulpit': 290, 'putting_green': 291, 'racecourse': 292, 'raceway': 293, 'raft': 294, 'railroad_track': 295, 'rainforest': 296, 'reception': 297, 'recreation_room': 298, 'residential_neighborhood': 299, 'restaurant': 300, 'restaurant_kitchen': 301, 'restaurant_patio': 302, 'rice_paddy': 303, 'riding_arena': 304, 'river': 305, 'rock_arch': 306, 'rope_bridge': 307, 'ruin': 308, 'runway': 309, 'sandbar': 310, 'sandbox': 311, 'sauna': 312, 'schoolhouse': 313, 'sea_cliff': 314, 'server_room': 315, 'shed': 316, 'shoe_shop': 317, 'shopfront': 318, 'shopping_mall/indoor': 319, 'shower': 320, 'skatepark': 321, 'ski_lodge': 322, 'ski_resort': 323, 'ski_slope': 324, 'sky': 325, 'skyscraper': 326, 'slum': 327, 'snowfield': 328, 'squash_court': 329, 'stable': 330, 'stadium/baseball': 331, 'stadium/football': 332, 'stage/indoor': 333, 'staircase': 334, 'street': 335, 'subway_interior': 336, 'subway_station/platform': 337, 'supermarket': 338, 'sushi_bar': 339, 'swamp': 340, 'swimming_pool/indoor': 341, 'swimming_pool/outdoor': 342, 'synagogue/indoor': 343, 'synagogue/outdoor': 344, 'television_studio': 345, 'temple/east_asia': 346, 'temple/south_asia': 347, 'tennis_court/indoor': 348, 'tennis_court/outdoor': 349, 'tent/outdoor': 350, 'theater/indoor_procenium': 351, 'theater/indoor_seats': 352, 'thriftshop': 353, 'throne_room': 354, 'ticket_booth': 355, 'toll_plaza': 356, 'topiary_garden': 357, 'tower': 358, 'toyshop': 359, 'track/outdoor': 360, 'train_railway': 361, 'train_station/platform': 362, 'tree_farm': 363, 'tree_house': 364, 'trench': 365, 'underwater/coral_reef': 366, 'utility_room': 367, 'valley': 368, 'van_interior': 369, 'vegetable_garden': 370, 'veranda': 371, 'veterinarians_office': 372, 'viaduct': 373, 'videostore': 374, 'village': 375, 'vineyard': 376, 'volcano': 377, 'volleyball_court/indoor': 378, 'volleyball_court/outdoor': 379, 'waiting_room': 380, 'warehouse/indoor': 381, 'water_tower': 382, 'waterfall/block': 383, 'waterfall/fan': 384, 'waterfall/plunge': 385, 'watering_hole': 386, 'wave': 387, 'wet_bar': 388, 'wheat_field': 389, 'wind_farm': 390, 'windmill': 391, 'wine_cellar/barrel_storage': 392, 'wine_cellar/bottle_storage': 393, 'wrestling_ring/indoor': 394, 'yard': 395, 'youth_hostel': 396}

SUN_SCENE_IND2LABEL = {v:k for k, v in SUN_SCENE_LABEL2IND.items()}